import request from "axios";

// 获取目录树
export function getDirectoryTree() {
    return request.get('/api/document/directories');
}

// 获取文件列表
export function getFileList(params) {
    return request.get('/api/document/files', { params });
}

// 上传文件
export function uploadFile(data) {
    return request.post('/api/document/upload', data, {
        headers: { 'Content-Type': 'multipart/form-data' }
    });
}

// 下载文件
export function downloadFile(path) {
    return request.get(`/api/document/download?path=${encodeURIComponent(path)}`, {
        responseType: 'blob'
    });
}

// 删除文件
export function deleteFile(path) {
    return request.delete(`/api/document/delete?path=${encodeURIComponent(path)}`);
}